package com.frost.aop.proxy;

import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
//        HouseSubject houseSubject = new HouseProxy(new RealHouseSubject());
//        houseSubject.rentHouse();

        // 目标类
        RealHouseSubject target = new RealHouseSubject();
        HouseSubject proxy = (HouseSubject) Proxy.newProxyInstance(
                target.getClass().getClassLoader(),
                new Class[] {HouseSubject.class},
                new JDKInvocationHandler(target)
        );
        proxy.rentHouse();


    }
}
